package com.cekanet.mybudget;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cekanet.mybudget.dbutils.StatementHandler;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

@SuppressWarnings("serial")
public class SynthesisPageServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {

		UserService userService = UserServiceFactory.getUserService();
		
		req.setAttribute("username", userService.getCurrentUser().getNickname());
		req.setAttribute("logoutURL", userService.createLogoutURL(req.getRequestURI()));
		
		StatementHandler statementHandler = new StatementHandler(userService.getCurrentUser().getUserId());
		
		req.setAttribute("itemNameList", statementHandler.getUserItemNameList());
		
		req.getRequestDispatcher("synthesis.jsp").forward(req, resp);
	}
}
